package com.gjszn.kh.context;

import java.util.HashMap;
import java.util.Map;

import com.gjszn.kh.model.RecommendationCode;

/**    
* @Title: MemberContext.java  
* @Package com.gjszn.kh.context    
* @author jys@nx-yt.com    
* @date 2015年12月31日 上午11:18:19  
* @version V1.0    
* @Description: TODO(用一句话描述该文件做什么)
********************************************/
public class MemberRCodeContext {
	
	private static Map<String, RecommendationCode> memberRCodeMap = new HashMap<String, RecommendationCode>();
	
	public static Map<String, RecommendationCode> getMemberRCodeMap() {
		return memberRCodeMap;
	}
	
//	public static Map<String, Set<String>> getRCodeSetForMember() {
//		for(Map.Entry<String, Member> entry : MemberContext.getMemberMap().entrySet()){
//			Set<String> rcodeSet = null;
//			for(Map.Entry<Integer, RecommendationCode> rcodeBean : memberRCodeMap.entrySet()){
//				
//			}
//		}
//		
//		return memberRCodeMap;
//	}
	
	public static boolean isInclude(String rcode){
		return memberRCodeMap.containsKey(rcode);
	}
	
	public static RecommendationCode getByKey(String rcode){
		return memberRCodeMap.get(rcode);
	}

	public static void setMemberRCodeMap(Map<String, RecommendationCode> memberRCodeMap) {
		MemberRCodeContext.memberRCodeMap = memberRCodeMap;
	}
	
	public static void add(RecommendationCode recommendationCode){
		memberRCodeMap.put(recommendationCode.getCode(), recommendationCode);
	}
	
	public static void update(RecommendationCode recommendationCode){
		memberRCodeMap.remove(recommendationCode.getCode());
		memberRCodeMap.put(recommendationCode.getCode(), recommendationCode);
	}
	
	public static void delete(RecommendationCode recommendationCode){
		memberRCodeMap.remove(recommendationCode.getCode());
	}
	
}

